﻿using Fibot.HYYY.K3Cloud.Wdt.Application.Base;
using Fibot.HYYY.K3Cloud.Wdt.Application.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Fibot.HYYY.K3Cloud.Wdt.Web.Entry.Controllers
{
    /// <summary>
    /// 旺店通
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class WdtController : ControllerBase
    {
        private readonly ILogger _logger;

        public WdtController(ILogger<WdtController> logger)
        {
            _logger = logger;
        }

        /// <summary>
        /// 同步旺店通店铺
        /// </summary>
        /// <returns></returns>
        [HttpGet("synShop")]
        public BaseHttpResultDto synShop()
        {
            WdtServices service = new WdtServices(_logger);
            return service.synShop();
        }

        /// <summary>
        /// 同步旺店通销售出库
        /// </summary>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        [HttpGet("synOutStockBill")]
        public BaseHttpResultDto synOutStockBill(DateTime startTime, DateTime endTime)
        {
            WdtServices service = new WdtServices(_logger);
            return service.synOutStockBill(startTime, endTime);
        }

        /// <summary>
        /// 同步旺店通销售出库到金蝶
        /// </summary>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        [HttpGet("synBillToCloud")]
        public BaseHttpResultDto synOutStockBill(string billNo)
        {
            WdtServices service = new WdtServices(_logger);
            return service.synBillToCloud(billNo);
        }

    }
}
